/**
* @Author: zmx
* @Date: 2023/9/26
* @Description:
*/
<template>
  <el-dialog :title="'实时监控'" :visible.sync="show" append-to-body width="1000px" :before-close="cancel">
    <div class="videoContent">
      <div class="center">
        <el-table :data="tableDataList" :header-cell-style="{background:'#D6D6D6',color:'#404040'}" style="width: 300px">
          <el-table-column prop="id" label="ID"></el-table-column>
          <el-table-column prop="name" label="位置"></el-table-column>
          <el-table-column label="操作">
            <template v-slot="scope">
              <el-button class="common-btn">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="right">
        <div style="margin-top: 15px;margin-bottom: 10px">
          江苏省南京市江宁区九香河生态公园充电站-实时监控
        </div>
        <div style="width: 100%;">
          <Artplayer @get-instance="getInstance" :option="option" :style="style" :cream="false"/>
        </div>
        <div style="margin-top: 20px">
          <el-form :inline="true" :model="formInline" label-width="80px">
            <el-row>
              <el-form-item label="是否排队：">
                <el-select
                  v-model="formInline.isLineUp"
                  value-key="id"
                  filterable
                  style="width: 200px"
                >
                  <el-option
                    v-for="item in isLineUp"
                    :key="item.value"
                    :label="item.name"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
<!--              <el-form-item label="排队数量：">-->
<!--                <el-input-number :disabled="formInline.isLineUp===0"  v-model="formInline.lineUpNum" placeholder="排队数量"></el-input-number>-->
<!--              </el-form-item>-->
            </el-row>
            <el-form-item>
              <el-button type="primary" @click="onSubmit">修改</el-button>
              <el-button @click="cancel">取消</el-button>
            </el-form-item>
          </el-form>
        </div>
      </div>
      </div>
  </el-dialog>
</template>

<script>
import {warn,patrol} from '../../api/inspection/apiUntil'
import Artplayer from "../inspection/Artplayer.vue";
import video from '../../../static/img/sqldev_20230902.mp4'
import {sortChargeUpdate} from "../../api/inspection/warn";
import {getPatrolCameraList} from "../../api/inspection/pator";

export default {
  props: ['DialogVideo', 'row'],
  components: {
    Artplayer,
  },
  data() {
    return {
      formInline:{
        isLineUp:'',
        lineUpNum:''
      },
      isLineUp:[
        {
          name:'否',
          value:0
        },
        {
          name:'是',
          value:1
        },
      ],
      option: {
        url: video,
      },
      style: {
        width: "100%",
        height: "300px",
      },
      show: false,
      tableDataList: [],
      urlImg: '',
    };
  },
  mounted() {
    //显示弹窗
    this.show = this.DialogVideo
    this.formInline.isLineUp = this.row.isLineUp
    this.getInit()
    this.getPatrolCameraList()
  },
  methods: {
    onSubmit(){
      if(this.formInline.isLineUp===0){
        this.formInline.lineUpNum = 0
      }
      warn.sortChargeUpdate({...this.formInline,stationId:this.row.stationId}).then((res) => {
        if (res) {
          this.cancel()
        }
      })
    },
    cancel() {
      this.show = false
      this.$parent.closeDialogVideo()
    },
    getInstance(art) {

    },
    getInit() {

    },
    //获取摄像头列表
    getPatrolCameraList() {
      console.log(this.row,'mmmm')
      patrol.getPatrolCameraList({stationName: this.row.stationName}).then((res) => {
        if (res) {
          this.tableDataList = res.data
        }
      })
    }
  }
};
</script>

<style lang="scss" scoped>
> > > .el-dialog__header {
  padding: 20px !important;
  background: #1B7B87;
}

> > > .el-dialog__title {
  color: #fff !important;
  font-size: 16px;
}

> > > .el-dialog__body {
  padding-top: 0;
}

> > > .el-table {
  margin-top: 0;
}

.videoContent {
  display: flex;

  .left {
    width: 300px;
    margin-right: 10px;

    div {
      margin-top: 15px;

      span {
        display: inline-block;

      }
    }

  }

  .center {
    margin-top: 15px;
    border-radius: 4px;
    border: 1px solid #c2c1c1;
    margin-right: 20px;
  }

  .right {
    flex: 1;
  }
}

.bottomImg {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-top: 20px;
  overflow: hidden;

  .brightImg {
    width: 30px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    color: #ccc;
    background: #7f7e7e;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    margin-right: 10px;
    padding: 15px 0;
  }

  .brightBox {
    display: flex;
    height: 80px;
    align-items: center;
    margin-right: 15px;
    margin-top: 10px;
    margin-bottom: 10px;

    .addBright {
      width: 25px;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      color: red;
      border: 1px solid red;
      text-align: center;
      font-size: 16px;
      margin-left: 10px;
      cursor: pointer;

    }

    .imgBox {
      width: 100px;
      height: 80px;
      position: relative;

      .deleteImg {
        position: absolute;
        right: 5px;
        top: 0;
        cursor: pointer;
      }

      img {
        height: 100%;
        width: 100%;
        object-fit: cover;
      }
    }
  }

}
</style>
